Skip to content

Fix symlinked .venv interpreter discovery#3509

Open
sjh9714 wants to merge 1 commit into
facebook:mainfrom
sjh9714:fix-symlinked-venv-discovery
Open

Fix symlinked .venv interpreter discovery#3509
sjh9714 wants to merge 1 commit into
facebook:mainfrom
sjh9714:fix-symlinked-venv-discovery

Conversation

@sjh9714
Copy link
Copy Markdown

@sjh9714 sjh9714 commented May 20, 2026

Summary

Fixes #3458.

Pyrefly could see pyvenv.cfg through a project-root .venv symlink, but then used the walk-based interpreter lookup with symlink following disabled. That meant a standard symlinked .venv was skipped and Pyrefly fell back to the system interpreter.

This change checks the standard venv interpreter path directly when pyvenv.cfg is present, preserving the symlink-prefixed path, and keeps the existing walk-based fallback for nonstandard layouts.

Note: I used Codex while preparing this change, and I reviewed the final diff and ran the listed checks locally.

Test Plan

  • PATH="$HOME/.cargo/bin:$PATH" cargo test -p pyrefly_config test_find_detects_symlinked_project_venv (failed before the fix with left: None)
  • PATH="$HOME/.cargo/bin:$PATH" cargo test -p pyrefly_config environment::venv::tests::test_find_detects_symlinked_project_venv -- --exact
  • PATH="$HOME/.cargo/bin:$PATH" cargo test -p pyrefly_config environment::venv
  • PATH="$HOME/.cargo/bin:$PATH" cargo test -p pyrefly_config
  • PATH="$HOME/.cargo/bin:$PATH" python3 test.py --no-test --no-conformance --no-jsonschema
  • git diff --check

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 20, 2026

Hi @sjh9714!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 20, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 22, 2026

@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this in D106044969.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pyrefly 1.0.0 does not auto-detect project-root .venv when .venv is a symlink

2 participants